package com.zrrd.thread._06_daemon;

/**
 * @author WanJl
 * @version 1.0
 * @title MyThread
 * @description
 * @create 2023/10/29 14:35
 */
public class MyThread {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 20; i++) {
                System.out.println(Thread.currentThread().getName()+"----"+i);
            }
        },"线程1");

        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println(Thread.currentThread().getName()+"----"+i);
            }
        },"守护线程1");

        //设置t2线程为守护线程
        t2.setDaemon(true);

        t1.start();
        t2.start();
    }
}
